package com.poizon.infrastructure.common.util;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.Properties;

/**
 * 配置解析工具类
 */
public class StringToPropertiesConverter {
    /**
     * 字符串解析成properties
     */
    public static Properties convertStringToProperties(String str) {
        Properties properties = new Properties();
        try (ByteArrayInputStream inputStream = new ByteArrayInputStream(str.getBytes())) {
            properties.load(inputStream);
        } catch (IOException e) {
            throw new RuntimeException("Error loading properties from string", e);
        }
        return properties;
    }
}
